<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c"%>
<%@ taglib uri="http://www.longtop.com/intelliweb" prefix="e"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<title>Insert title here</title>
	</head>

	<e:View id="view">
	    <script type="text/javascript">SkinUtil.getSkin();</script>
	    <script type="text/javascript">SkinUtil.getModuleSkin();</script>
    
		<div id="Invisual Controls" style="min-height: 40px; background-color: LemonChiffon;" >
			<e:Dataset id="Dataset_CodeType" datasetDefinition="DatasetDefinition_sys.dsd" datasetRef="Dataset_CodeType" pageSize="15" loadDataCommand="Command_Load">
				<e:Field name="codeTypeId" dataType="string" label="代码类别ID" maxLength="32" required="true" />
				<e:Field name="codeTypeName" dataType="string" label="代码类别名称" maxLength="100" required="true" />
				<e:Field name="sortNo" dataType="integer" label="排序号" maxLength="10" required="true" />
				<e:Field name="remark" dataType="string" label="备注" maxLength="400" />
			</e:Dataset>
			
			<e:Command id="Command_Save" action="com.longtop.framework.sys.codeType.web.CodeTypeListAction" method="saveCodeType" submitForm="true" validateRequired="true" onExecuteSuccess="Button_Search_onClick()">
				<e:DatasetInfo name="DatasetInfo1" dataset="Dataset_CodeType" alwayRefreshClient="false" submitType="changes"></e:DatasetInfo>
			</e:Command>
			<e:Command id="Command_Search" action="com.longtop.framework.sys.codeType.web.CodeTypeListAction" method="searchCodeType" submitForm="true" submitFormScope="all" validateRequired="true">
				<e:DatasetInfo name="DatasetInfo2" dataset="Dataset_CodeType" alwayRefreshClient="true" submitType="all"></e:DatasetInfo>
			</e:Command>
			<e:Command id="Command_Load" action="com.longtop.framework.sys.codeType.web.CodeTypeListAction" method="loadCodeType" showHintInfoOnSuccess="false">
				<e:DatasetInfo name="DatasetInfo3" dataset="Dataset_CodeType" alwayRefreshClient="true"></e:DatasetInfo>
			</e:Command>
		</div>

		<body>
			<e:Page id="ePage" action="com.longtop.framework.sys.codeType.web.CodeTypeListAction" style="min-height: 80px; width: 100%; height: 100%;" onAfterLoadPage="ePage_onAfterLoadPage()">
				<table style="width: 100%; height: 100%;" border="0" cellpadding="0" cellspacing="0" width="100%" align="center">
					<tr>
						<td align="left" valign="top">
							<e:Panel id="Panel_Search" style="width: 285px; height: 100%" caption="查询条件" captionIcon="/images/query_win.gif" captionStyle="color:#888888" allowFold="true" showArrowButton="false">
								<table style="text-align: left; width: 100%;" border="0" cellpadding="3" cellspacing="3" width="100%" align="center">
									<tr>
										<td width="80px" align="right">
											<e:Label id="Label_CodeTypeId" caption="代码类别ID"></e:Label>
										</td>
										<td>
											<e:Text id="Text_CodeTypeId" style="width:169px;"></e:Text>
										</td>
									</tr>
									<tr>
										<td align="right">
											<e:Label id="Label_CodeTypeName" caption="代码类别名称"></e:Label>
										</td>
										<td>
											<e:Text id="Text_CodeTypeName" style="width:169px;"></e:Text>
										</td>
									</tr>
									<tr>
										<td></td>
										<td>
											<e:Button id="Button_Search" style='height: 22px; width: 70px' caption="查询" command="Command_Search" icon="/images/query.gif" onClick="Button_Search_onClick()"></e:Button>
										</td>
									</tr>
								</table>
							</e:Panel>
						</td>
						<td valign="top" width="100%">
							<e:Panel id="Panel_Result" style="width: 100%; height: 100%" captionStyle="color:#888888" caption="查询结果列表" captionIcon="/images/list_win.gif" showArrowButton="false">
								<table style="text-align: left; width: 100%;" border="0" cellpadding="3" cellspacing="3" >
									<tr>
										<td>
											<table style="text-align: left; width: 100%;" border="0" cellpadding="0" cellspacing="0">
												<tr>
													<td height="27px" width="1%">
														<e:RecordNavigator id="RecordNavigator_CodeType" dataset="Dataset_CodeType" showNavigatorButton="false">
															<e:RecordButton id="RecordButton_insert" label="新增" onClick="insertRecord" icon="/images/add.gif"></e:RecordButton>
															<e:RecordButton id="RecordButton_delete" label="删除" onClick="deleteRecord" icon="/images/delete.gif"></e:RecordButton>
															<e:RecordButton id="RecordButton_save" label="保存" icon="/images/submit.gif" onClick="RecordButton_save_onClick()"></e:RecordButton>
														</e:RecordNavigator>
													</td>
													<td align="left" width="99%"><e:PageNavigator id="PageNavigator_CodeType" dataset="Dataset_CodeType" showRecordNum="true"></e:PageNavigator></td>
												</tr>
											</table>
										</td>
									</tr>
									<tr>
										<td>
											<e:Grid id="Grid_CodeType" style="width: 100%; height: 458px;" showIndex="true" dataset="Dataset_CodeType" onClick="Grid_CodeType_onClick()">
											</e:Grid>
										</td>
									</tr>
								</table>
							</e:Panel>
						</td>
					</tr>
			    </table>
			</e:Page>
		</body>
	</e:View>
</html>	

<script type="text/javascript">
	//init
	function ePage_onAfterLoadPage(){
	}
	
	//查询
	function Button_Search_onClick(){
	    Command_Search.execute();
	}
	
	//保存
	function RecordButton_save_onClick(){
	    Command_Save.execute();
	}
		
	//单击记录,确定主键是否可编辑
	function Grid_CodeType_onClick(){
		var element = event.srcElement;
		if(element.isDataCell){
			if(element.isDataCell){
		        var currentRecord = element.record;
		        if(currentRecord.state == Constant.RECORD.STATE_NEW || currentRecord.state == Constant.RECORD.STATE_INSERT) {
	          		currentRecord.dataset.getField("codeTypeId").setReadOnly(false);
	          	} else{
			        currentRecord.dataset.getField("codeTypeId").setReadOnly(true);
	       		}
			}
		}
	}
</script>